#!/usr/bin/bash

input=$1

if [ -z $input ]; then
    echo "debian or archlinux"
    exit 1
fi

if [ $input = "debian" ]; then
    
    mkdir -p ./ScreenInterLock_deb/etc/screen_inter_lock
    mkdir -p ./ScreenInterLock_deb/usr/bin
    mkdir -p ./ScreenInterLock_deb/etc/screen_inter_lock/default_images
    
    ln ../ScreenInterLock ./ScreenInterLock_deb/usr/bin/ScreenInterLock
    ln ../default_images/* ./ScreenInterLock_deb/etc/screen_inter_lock/default_images
    
    dpkg-deb --build ./ScreenInterLock_deb ScreenInterLock.deb
    
    rm -r ./ScreenInterLock_deb/etc
    rm -r ./ScreenInterLock_deb/usr
    
    
elif [ $input = "archlinux" ]; then

    ln ../ScreenInterLock ./ScreenInterLock_archlinux/ 
    
    cd ./ScreenInterLock_archlinux
    
    makepkg
    
    rm -r pkg
    rm -r src
    
    unlink ScreenInterLock
    
    mv *.zst ../

fi
